package com.wandian.cqcsk.adapter.mine;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.mylib.libcore.utils.GlideUtil;
import com.mylib.libcore.utils.UIUtils;
import com.wandian.cqcsk.R;
import com.wandian.cqcsk.bean.InviteRecordBean;

/**
 * @author Administrator
 * @date 2019/12/16-13:32
 * @description FriendsRecycleAdapter
 **/
public class FriendsRecycleAdapter extends BaseQuickAdapter<InviteRecordBean, BaseViewHolder> {
    private String showState = "0";
    public FriendsRecycleAdapter(int layoutResId,String showState) {
        super(layoutResId);
        this.showState = showState;
    }


    @Override
    protected void convert(BaseViewHolder helper, InviteRecordBean item) {
        RoundedImageView iv_user_head =helper.getView(R.id.iv_user_head);
        GlideUtil.intoHeadImg(mContext,item.getHeadPic(),iv_user_head);
        TextView tv_user_name =helper.getView(R.id.tv_user_name);
        tv_user_name.setText(item.getNickName()+"");
        TextView tv_user_id =helper.getView(R.id.tv_user_id);
        tv_user_id.setText("ID:"+item.getId()+"");
        TextView tv_band_wx =helper.getView(R.id.tv_band_wx);
        if(!UIUtils.isEmpty(item.getIsWx()) && item.getIsWx().equals("1")){
            tv_band_wx.setTextColor(mContext.getResources().getColor(R.color.text_blue));
             tv_band_wx.setText("已绑定微信");
        }else {
            tv_band_wx.setTextColor(mContext.getResources().getColor(R.color.color_red));
            tv_band_wx.setText("未绑定微信");
        }
        TextView tv_is_dk =helper.getView(R.id.tv_is_dk);
        if(!UIUtils.isEmpty(item.getClockTag()) && item.getClockTag().equals("1")){
            tv_is_dk.setTextColor(mContext.getResources().getColor(R.color.color_orange));
            tv_is_dk.setText("已参与打卡");
        }else {
            tv_is_dk.setTextColor(mContext.getResources().getColor(R.color.color_red));
            tv_is_dk.setText("未参与打卡");
        }
        TextView tv_user_state =helper.getView(R.id.tv_user_state);
        if(showState.equals("1")) {
            if (!UIUtils.isEmpty(item.getClockTag()) && item.getClockTag().equals("1") &&
                    !UIUtils.isEmpty(item.getIsWx()) && item.getIsWx().equals("1")) {
                 tv_user_state.setText("已完成");
                 tv_user_state.setTextColor(mContext.getResources().getColor(R.color.sys_text_color));
            } else {
                tv_user_state.setTextColor(mContext.getResources().getColor(R.color.color_red));
                tv_user_state.setText("未完成");
            }
        }else {
            tv_user_state.setVisibility(View.GONE);
        }
    }

}
